import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/task/process_currency_emergency_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/role_personnel_entity.dart';

import 'package:enterprise_v6_app/app/data/entities/common/form_value_entity.dart';


ProcessCurrencyEmergencyEntity $ProcessCurrencyEmergencyEntityFromJson(Map<String, dynamic> json) {
  final ProcessCurrencyEmergencyEntity processCurrencyEmergencyEntity = ProcessCurrencyEmergencyEntity();
  final String? approvalOpinions = jsonConvert.convert<String>(json['approvalOpinions']);
  if (approvalOpinions != null) {
    processCurrencyEmergencyEntity.approvalOpinions = approvalOpinions;
  }
  final String? approvalUser = jsonConvert.convert<String>(json['approvalUser']);
  if (approvalUser != null) {
    processCurrencyEmergencyEntity.approvalUser = approvalUser;
  }
  final String? auditDepartment = jsonConvert.convert<String>(json['auditDepartment']);
  if (auditDepartment != null) {
    processCurrencyEmergencyEntity.auditDepartment = auditDepartment;
  }
  final List<FormValueEntity>? formValue = (json['formValue'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<FormValueEntity>(e) as FormValueEntity).toList();
  if (formValue != null) {
    processCurrencyEmergencyEntity.formValue = formValue;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    processCurrencyEmergencyEntity.id = id;
  }
  final bool? last = jsonConvert.convert<bool>(json['last']);
  if (last != null) {
    processCurrencyEmergencyEntity.last = last;
  }
  final List<RolePersonnelEntity>? nextNodeExecutor = (json['nextNodeExecutor'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<RolePersonnelEntity>(e) as RolePersonnelEntity).toList();
  if (nextNodeExecutor != null) {
    processCurrencyEmergencyEntity.nextNodeExecutor = nextNodeExecutor;
  }
  final String? nodeId = jsonConvert.convert<String>(json['nodeId']);
  if (nodeId != null) {
    processCurrencyEmergencyEntity.nodeId = nodeId;
  }
  final String? rtNodeId = jsonConvert.convert<String>(json['rtNodeId']);
  if (rtNodeId != null) {
    processCurrencyEmergencyEntity.rtNodeId = rtNodeId;
  }
  final String? processEncoding = jsonConvert.convert<String>(json['processEncoding']);
  if (processEncoding != null) {
    processCurrencyEmergencyEntity.processEncoding = processEncoding;
  }
  final bool? reject = jsonConvert.convert<bool>(json['reject']);
  if (reject != null) {
    processCurrencyEmergencyEntity.reject = reject;
  }
  final String? rtemplateId = jsonConvert.convert<String>(json['rtemplateId']);
  if (rtemplateId != null) {
    processCurrencyEmergencyEntity.rtemplateId = rtemplateId;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    processCurrencyEmergencyEntity.status = status;
  }
  final List<String>? regions = (json['regions'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (regions != null) {
    processCurrencyEmergencyEntity.regions = regions;
  }
  final List<String>? equipmentIds = (json['equipmentIds'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (equipmentIds != null) {
    processCurrencyEmergencyEntity.equipmentIds = equipmentIds;
  }
  final List<String>? views = (json['views'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (views != null) {
    processCurrencyEmergencyEntity.views = views;
  }
  return processCurrencyEmergencyEntity;
}

Map<String, dynamic> $ProcessCurrencyEmergencyEntityToJson(ProcessCurrencyEmergencyEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['approvalOpinions'] = entity.approvalOpinions;
  data['approvalUser'] = entity.approvalUser;
  data['auditDepartment'] = entity.auditDepartment;
  data['formValue'] = entity.formValue.map((v) => v.toJson()).toList();
  data['id'] = entity.id;
  data['last'] = entity.last;
  data['nextNodeExecutor'] = entity.nextNodeExecutor.map((v) => v.toJson()).toList();
  data['nodeId'] = entity.nodeId;
  data['rtNodeId'] = entity.rtNodeId;
  data['processEncoding'] = entity.processEncoding;
  data['reject'] = entity.reject;
  data['rtemplateId'] = entity.rtemplateId;
  data['status'] = entity.status;
  data['regions'] = entity.regions;
  data['equipmentIds'] = entity.equipmentIds;
  data['views'] = entity.views;
  return data;
}

extension ProcessCurrencyEmergencyEntityExtension on ProcessCurrencyEmergencyEntity {
  ProcessCurrencyEmergencyEntity copyWith({
    String? approvalOpinions,
    String? approvalUser,
    String? auditDepartment,
    List<FormValueEntity>? formValue,
    String? id,
    bool? last,
    List<RolePersonnelEntity>? nextNodeExecutor,
    String? nodeId,
    String? rtNodeId,
    String? processEncoding,
    bool? reject,
    String? rtemplateId,
    int? status,
    List<String>? regions,
    List<String>? equipmentIds,
    List<String>? views,
  }) {
    return ProcessCurrencyEmergencyEntity()
      ..approvalOpinions = approvalOpinions ?? this.approvalOpinions
      ..approvalUser = approvalUser ?? this.approvalUser
      ..auditDepartment = auditDepartment ?? this.auditDepartment
      ..formValue = formValue ?? this.formValue
      ..id = id ?? this.id
      ..last = last ?? this.last
      ..nextNodeExecutor = nextNodeExecutor ?? this.nextNodeExecutor
      ..nodeId = nodeId ?? this.nodeId
      ..rtNodeId = rtNodeId ?? this.rtNodeId
      ..processEncoding = processEncoding ?? this.processEncoding
      ..reject = reject ?? this.reject
      ..rtemplateId = rtemplateId ?? this.rtemplateId
      ..status = status ?? this.status
      ..regions = regions ?? this.regions
      ..equipmentIds = equipmentIds ?? this.equipmentIds
      ..views = views ?? this.views;
  }
}
